<?php

use App\Http\Controllers\Api\UploadController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

Route::prefix('v1')->name('api.v1.')->group(function () {
    Route::prefix('mini')->name('mini.')->group(function () {
        Route::post('session', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'session'])->name('session');
//        Route::post('login', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'login'])->name('login');
//        Route::post('logout', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'logout'])->name('logout');
//        Route::post('get-login', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'getLogin'])->name('getlogin');

        Route::prefix('system')->name('system.')->group(function () {
            Route::get('test-locations', [App\Http\Controllers\Api\Miniprogram\SystemController::class, 'testLocations'])->name('test.locations');
        });

        Route::middleware('auth:sanctum')->group(function () {
            Route::get('userinfo', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'userinfo'])->name('userinfo');
            Route::post('get-phone', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'getPhone'])->name('get.phone');
            Route::post('save-userinfo', [App\Http\Controllers\Api\Miniprogram\AuthController::class, 'saveUserInfo'])->name('save.userinfo');

            Route::post('home-banners', [App\Http\Controllers\Api\Miniprogram\HomeController::class, 'banners'])->name('home.banners');
            Route::post('home-selected-goods', [App\Http\Controllers\Api\Miniprogram\HomeController::class, 'selectedGoods'])->name('home.selected.goods');

            Route::post('check-item-categories', [App\Http\Controllers\Api\Miniprogram\CheckItemController::class, 'categories'])->name('check.item.categories');
            Route::post('check-item-get-list', [App\Http\Controllers\Api\Miniprogram\CheckItemController::class, 'getList'])->name('check.item.get.list');
            Route::post('check-item-get-detail', [App\Http\Controllers\Api\Miniprogram\CheckItemController::class, 'getDetail'])->name('check.item.get.detail');

            Route::post('check-times', [App\Http\Controllers\Api\Miniprogram\CheckTimeController::class, 'getCheckTimes'])->name('check.times');

            Route::post('family-users', [App\Http\Controllers\Api\Miniprogram\FamilyController::class, 'getUsers'])->name('family.users');
            Route::post('family-user', [App\Http\Controllers\Api\Miniprogram\FamilyController::class, 'getUser'])->name('family.user');
            Route::post('family-save-user', [App\Http\Controllers\Api\Miniprogram\FamilyController::class, 'saveUser'])->name('family.save.user');

            Route::post('get-locations', [App\Http\Controllers\Api\Miniprogram\TestLocationController::class, 'getList'])->name('get.locations');

            Route::post('question-categories', [App\Http\Controllers\Api\Miniprogram\QuestionController::class, 'categories'])->name('question.categories');
            Route::post('question-get-list', [App\Http\Controllers\Api\Miniprogram\QuestionController::class, 'getList'])->name('question.get.list');
            Route::post('question-get-detail', [App\Http\Controllers\Api\Miniprogram\QuestionController::class, 'getDetail'])->name('question.get.detail');

            Route::post('generate-order', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'generateOrder'])->name('generate.order');
            Route::post('get-order', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'getOrder'])->name('get.order');
            Route::post('modify-order', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'modifyOrder'])->name('modify.order');
            Route::post('pay-finish', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'payFinish'])->name('pay.finish');
            Route::post('get-order-list', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'getList'])->name('get.order.list');
            Route::post('delete-order', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'deleteOrder'])->name('delete.order');

            Route::post('sample-bind-user', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'bindUser'])->name('sample.bind.user');

            Route::post('appointment-get-list', [App\Http\Controllers\Api\Miniprogram\AppointmentController::class, 'getList'])->name('appointment.get.list');

            Route::post('sample-get-list', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'getList'])->name('sample.get.list');
            Route::post('sample-get-detail', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'getDetail'])->name('sample.get.detail');
            Route::post('sample-get-test-locations', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'getTestLocations'])->name('sample.get.test.locations');
            Route::post('sample-set-test-location', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setTestLocation'])->name('sample.set.test.location');
            Route::post('sample-set-check-type', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setCheckType'])->name('sample.set.check.type');
            Route::post('sample-set-checker', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setChecker'])->name('sample.set.checker');
            Route::post('sample-set-check-time', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setCheckTime'])->name('sample.set.check.time');
            Route::post('sample-set-check-date', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setCheckDate'])->name('sample.set.check.date');
            Route::post('sample-set-door-address', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setDoorAddress'])->name('sample.set.door.address');
            Route::post('sample-set-door-phone', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'setDoorPhone'])->name('sample.set.door.phone');
            Route::post('sample-write-off', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'writeOff'])->name('sample.write.off');
            Route::post('sample-scan-write-off', [App\Http\Controllers\Api\Miniprogram\SampleController::class, 'scanWriteOff'])->name('sample.scan.write.off');

            Route::post('order-do-pay', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'doPay'])->name('order.do.pay');
            Route::post('order-do-refund', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'doRefund'])->name('order.do.refund');
        });
        Route::get('download-order-qrcode-files', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'downloadOrderQrcodeFiles'])->name('download.order.qrcode.files');

        Route::post('payment_notify', [App\Http\Controllers\Api\Miniprogram\OrderController::class, 'paymentNotify']);
    });

    Route::post('upload-file', [UploadController::class, 'uploadFile'])->name('upload.file');
    Route::get('download', [\App\Http\Controllers\Api\DownloadController::class, 'download'])->name('download');
//
//        Route::post('sms-code', [MobileController::class, 'smsCode'])->name('sms.code');
//        Route::get('test-time', [MobileController::class, 'testTime']);
//
//        Route::post('track-visit', [\App\Http\Controllers\Api\TrackController::class, 'visit'])->name('track.visit');
//        Route::post('track-endvisit', [\App\Http\Controllers\Api\TrackController::class, 'endVisit'])->name('track.endvisit');
//        Route::post('track-event', [\App\Http\Controllers\Api\TrackController::class, 'event'])->name('track.event');
});
